/**
 *
 * 2007-11-1 下午08:38:08
 * @author xuhuan
 */

package edu.ccut.saturn.studio.wfg.figure;

import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Image;

public class SaturnFigure extends Figure {

	protected Label nameLabel;
	
	protected Label iconLabel;

	public SaturnFigure() {
		ToolbarLayout layout = new ToolbarLayout();
		
		layout.setStretchMinorAxis(false);
		layout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
		layout.setSpacing(2);
		setLayoutManager(layout);
		
		super.add(iconLabel = new Label());
		super.add(nameLabel = new Label());
	}

	public String getName() {
		return nameLabel.getText();
	}

	public void setName(String name) {
		this.nameLabel.setText(name);
	}

	public void setIcon(Image image) {
		this.iconLabel.setIcon(image);
	}

	public Rectangle getTextBounds() {
		return this.nameLabel.getTextBounds();
	}
}